/*
 * Author  : Xerxes
 * Program : C.cxx
 *
 *
 * I have not failed, I have just found 10000 ways that won't work.
 *
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define fo(i,ed) foR( i , 0 , ed )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )

#define START 1
#define END 2

inline void wait(double seconds) {
	double endtime = clock()+(seconds * CLOCKS_PER_SEC);
	while (clock() < endtime) {
		;
	}
}
int n;
struct span{
  int v;
  int type;
};

inline bool operator < (span a, span b){
	if( a.v < b.v ){
		return true;
	}
	else if( a.v == b.v ){
		return a.type < b.type;
	}
  return false;
};
vector< span > vspan;
    
inline void Read(){
	CI(n);
	vspan.clear();
	fo(i,n){
		span ss,se;
		CI( ss.v );
		CI( se.v );
		  ss.type = START;
		  se.type = END;
      
		vspan.pb( ss );
		vspan.pb( se );
	}
	sort( vspan.begin(), vspan.end() );
}
inline void Proc(){
	int need = 0;
	int ans = 0;
	for(int i=0, j=SZ(vspan); i<j; ++i){
	
		if( vspan[i].type == START ){
			++need;
		}
		else{
			--need;
		}
		ans = max( ans, need );
	}
	
	cout<<ans<<"\n";
	
}

int main() {
	
	int k;
	CI(k);
	foE(i,1,k){
		Read();
		cout<<"Case "<<i<<": ";
		Proc();
	}
	
	return 0;
} 
